<template>
  <div>
    <start-activiti-component
        ref="startActivitiComponent"
        :model-id="modelId"
        :submit-act="instanceApi.start"
        :user-id="userId"
        @startOk="startOk"></start-activiti-component>
  </div>
</template>

<script>

import StartActivitiComponent from "@/views/start/activiti/components/startActivitiComponent";
import instanceApi from "@/api/start/activiti/instanceApi";
export default {
  name: "activitiStart",
  components: {StartActivitiComponent},
  data() {
    return {
      modelId: null,
      userId: null,
      instanceApi
    }
  },
  created() {
    this.loadParams()
  },
  methods: {
    loadParams() {
      console.log("加载数据")
      this.modelId = this.$route.query.modelId
      if (!this.modelId) this.modelId = this.$route.params.modelId
      this.userId = this.$route.query.userId
      if (!this.userId) this.userId = this.$route.params.userId
      this.$nextTick(() => {
        this.$refs.startActivitiComponent.init()
      });

    },
    startOk() {
      this.$alert('提交成功\n是否关闭当前页面', '系统提示', {
        confirmButtonText: '确定',
        callback: this.closePage
      });
    },
    closePage() {
      window.opener = null;
      window.open('', '_self');
      window.close();
    }
  }
}
</script>

<style scoped>

</style>
